package com.exm.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.MimeMessageHelper;
import org.springframework.stereotype.Service;

import javax.mail.MessagingException;
import javax.mail.internet.MimeMessage;

@Service
public class EmailService {

    @Autowired
    private JavaMailSender javaMailSender;

    public void simple(String to,String title,String txt){
        SimpleMailMessage msg = new SimpleMailMessage();
        msg.setFrom("2583549902@qq.com");//发送者
        msg.setTo(to);//接收者
        msg.setSubject(title);//标题
        msg.setText(txt);//内容
        javaMailSender.send(msg);
    }
}
